{% extends "base.html" %}

{% block title %}{{ username }} - {{ block.super }}{% endblock %}

{% block content %}
    <h2 class="grid_4 suffix_5">{{ username }}&rsquo;s Timeline</h2>
    <ul id="timeline" class="grid_9 alpha">
        {% for tweet in tweets %}
            <li>
                <a href="{% url userline tweet.username %}" class="username">{{ tweet.username }}</a>
                <span class="body">{{ tweet.body|urlize }}</span>
            </li>
        {% empty %}
            <li>There are no tweets yet.  Make sure to post one!</li>
        {% endfor %}
        {% if next %}
            <li class="more"><a href="?start={{ next }}">More</a></li>
        {% endif %}
    </ul>
{% endblock %}

{% block sidebar %}
    {% if request.user.is_authenticated %}
        {% ifnotequal request.user.id user.id %}
            <form method="POST" action="{% url modify_friend %}?next={{ request.path }}">
                <input type="hidden" name="{% if user.friend %}remove{% else %}add{% endif %}-friend" value="{{ user.id }}" />
                <input type="submit" value="{% if user.friend %}Remove{% else %}Add{% endif %} Friend" />
            </form>
        {% endifnotequal %}
    {% else %}
        <a href="{% url login %}?next={{ request.path }}&q={{ q }}">
            Login to add {{ username }} as a friend
        </a>
    {% endif %}
{% endblock %}
